package com.example.perplonews.a_d_fragment.c_video

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.viewpager.widget.ViewPager
import com.example.perplonews.R
import com.example.perplonews.a_d_fragment.c_video.adapter.VideoVpAdapter
import com.flyco.tablayout.SlidingTabLayout
import kotlinx.android.synthetic.main.fragment_video.*

class VideoFragment : Fragment() {
    private var rootView:View?= null
    private val videoTab: SlidingTabLayout by lazy { rootView!!.findViewById<SlidingTabLayout>(R.id.video_tab) }
    private val videoVp: ViewPager by lazy { rootView!!.findViewById<ViewPager>(R.id.video_vp) }!!


    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        rootView = layoutInflater.inflate(R.layout.fragment_video,container,false)
        init()
        return rootView
    }
    private fun init() {
        var list:ArrayList<Fragment> = ArrayList()
        list.add(Recom_Fragment())
        list.add(video2_Fragment())

        videoVp.adapter = VideoVpAdapter(activity?.supportFragmentManager!!,list)
        videoTab.setViewPager(videoVp)

    }



}